/** 全局静态值 v1.0.0 **/
var ka_top_loadIndexMap = new Map();//loading 加载
var ka_top_ajaOptionIndexMap = new Map();// AjaxOption 加载
var ka_top_log_codeInst;// 日志编码
var ka_grid_kagridBoolean = false;
var ka_grid_api = new Map();// 表格API
var ka_grid_config = new Map();// 表格配置
var ka_grid_config_div = new Map();// 表格配置
var ka_grid_findValue = new Map();// 表格查询值
var ka_grid_findShortcutValue = new Map();// 表格查询快捷值
var ka_grid_QueryType = new Map();// 表格查询Hmtl
var ka_grid_QueryValue = new Map();// 表格查询值渲染
var ka_grid_pageSize = new Map();// 表格分页参数
var ka_grid_sortValue = new Map();// 表格排序
var ka_grid_pageGridApi = new Map();// 表格分页
var ka_layer_loadingMap = new Map();// loadingMap
var ka_grid_rowsMap = new Map();// 单列选行触发
var ka_grid_columnMap = new Map();// 单字段触发
var ka_grid_formDesignerDataMap = new Map();// 设计表单
var ka_grid_formDesignerConfigMap = new Map();// 设计表单
var ka_grid_formDesignerSelectMap = new Map();// 设计表单
var ka_grid_formDesignerSelect_option = {
    height: 'auto',
    theme: {
        color: 'var(--global-primary-color)',
    },
    toolbar: {
        show: true,
        list: ['ALL', 'CLEAR', 'REVERSE', {
            name: '自定义',
            icon: 'el-icon-star-off',
            method(data) {
                alert('我是自定义的');
            }
        }]
    },
    filterable: true,
    filterMethod: function (val, item, index, prop) {
        if (val == item.value) {//把value相同的搜索出来
            return true;
        }
        if (item.name.indexOf(val) != -1) {//名称中包含的搜索出来
            return true;
        }
        return false;//不知道的就不管了
    },
};//设计表单 下拉公共配置
var kaLayuiLaypage = {
    count: 0, //数据总数
    limit: 10000, // 每页显示的条数。
    limits: [5, 10, 20, 50, 100, 500, 1000, 3000, 5000, 10000], // 每页条数的选择项
    curr: 1, // 初始化当前页码。
    layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'], // 功能布局
};
var kaValue = {
    isBackend: true,//是否后端
    isGeneratedFile: false,//是否生成JSON文件
    faCtx: function () {//头部
        return location.protocol + '//' + location.hostname;
    },
    qdCtx: function () {//正式
        return kaValue.faCtx() + ":83";
    },
    ctx: function () {//正式
        // return "http://172.16.73.116:89";
        // return "http://172.16.73.116:79";
        return kaValue.faCtx() + ":81";
    },
    fileCtx: function () {//文件请求
        return kaValue.faCtx() + ":8012";
    },
    aiCtx: function () {//AI 请求
        return kaValue.faCtx() + ":3001";
    },
    socketCtx: function () {//AI 请求
        return location.hostname;
    },
    downloadCtx: { //下载链接
        down: function(type){
            var url = "";
            if(type == "app"){
                url = kaValue.downloadCtx.app();
            } else if(type == "exe"){
                url = kaValue.downloadCtx.exe();
            } else if(type == "google"){
                 url = kaValue.downloadCtx.google();
            }
            const link = document.createElement('a');
            link.href = url;
            link.target = '_blank';
            link.rel = 'noopener noreferrer'; // 增强安全性
            link.click(); // 触发点击
        },
        app: function () { // 手机APP
          return "";
        },
        exe: function () { // EXE
            return "";
        },
        google: function () {// 谷歌浏览器
            return "";
        }
    },
    clt: function () {//当前语言
        var currentLanguage = sessionStorage.getItem("kaLanguageTypeCurrent");
        if (currentLanguage != undefined && currentLanguage != null && currentLanguage != "") {
            return currentLanguage;
        } else {
            currentLanguage = "1";
            sessionStorage.setItem("kaLanguageTypeCurrent", currentLanguage);
            return currentLanguage;
        }
    },
    clv: function () {//当前语言Value
        var currentLanguageValue = sessionStorage.getItem("kaLanguageValue");
        if (currentLanguageValue != undefined && currentLanguageValue != null && currentLanguageValue != "kaLanguageValue" && currentLanguageValue != "") {
            return JSON.parse(currentLanguageValue);
        } else {
            kaLanguage.loadingValue(kaValue.clt())
            return JSON.parse(sessionStorage.getItem("kaLanguageValue"));
        }
    },
    setLoginKAAccount: function (account) {//获取登录账号
        localStorage.setItem("loginKaaccount", account);
    },
    getLoginKAAccount: function () {
        return localStorage.getItem("loginKaaccount");
    },
    automaticLogon: function () {//自动登录信息
        var al = localStorage.getItem("ka_automatic_logon");
        if (al == undefined || al == null || al == "") {
            return undefined;
        }
        return al;
    },
    getUrl: function (urlCode) {//请求URL
        var kaUrl = {};
        var kaGetUrlStr = sessionStorage.getItem("KaGetUrl_" + urlCode);
        if (kaGetUrlStr == undefined || kaGetUrlStr == null || kaGetUrlStr == "") {
            var optionUrl = kaValue.ctx() + "/getPageUrl/" + urlCode;
            var option = {
                "urlCode": urlCode,
                "url": optionUrl,
                "async": false,
                "token": 1
            }
            option.success = function (re) {
                if (re.code == 200) {
                    kaUrl = re.data;
                    kaUrl.url = kaValue.ctx() + kaUrl.url;
                    sessionStorage.setItem("KaGetUrl_" + urlCode, JSON.stringify(kaUrl));
                } else {
                    kaMsg.error(re);
                }
            }
            ka.ajax(option);
        } else {
            kaUrl = JSON.parse(kaGetUrlStr);
        }
        return kaUrl;
    },
    layuiUse: ['admin', 'jquery', 'form', 'button', 'popup', 'step', 'formDesigner', 'layer', 'upload', 'echarts'],
    regMobile: /^1[3,5,7,8,9]\d{9}$/, //手机号码验证规则
    login: { // 登录页面
        url: {
            getConfig: "getConfig", // 获取配置
            captchaImage: "captchaImage", // 获取验证码
            loginTenant: "loginTenant", // 获取租户
            login: "login", // 登录
            commonAdGetSliderVerify: "commonAdGetSliderVerify", // 获取广告图片验证
            getPhonenVerCode: "getPhonenVerCode", // 获取手机验证码
            loginQrcodeVer: "loginQrcodeVer",// 获取二维码的编码
        },
        msg: {
            getPhonenVerCodeMsg1: "请输入正确的手机号!",
            getPhonenVerCodeMsg2: "请填写手机号码!",
            createAndverifyQrcodeMsg: "二维码已失效",
            createAndverifyQrcodeMsg2: "手机已经扫码",
            createAndverifyQrcodeMsg3: "二维码已失效",
            otherLogin: "请选择登录方式",
            registerAccount: "请选择注册身份",
            formOption1: "租户不能为空！",
            formOption2: "账户不能为空！",
            formOption3: "密码不能为空！",
            formOption4: "手机号码不能为空！",
            formOption5: "手机号码不正确！",
            formOption6: "手机验证码不能为空！",
            formOption7: "验证码不能为空！",
        },
        tabsStr: ["账号登录", "手机登录", "扫码登录"],
        otherLoginTab: ['手机登录', '企业微信', '钉钉登录'],
        registerAccountTab: ['供应商', '经销商', '系统员工']
    },
    forgotPassword: { // 忘记密码 
        url: {
            forgotPasswordImage: "forgotPasswordImage", // 忘记密码验证码
            getForgotPasswordUserInfor: "getForgotPasswordUserInfor", // 忘记密码 获取用户详情
            fWUpdateNewPassWord: "fWUpdateNewPassWord", // 忘记密码 更新新密码
            getPhonenVerCode: "getPhonenVerCode", // 忘记密码 获取手机验证码
            authentication: "authentication", // 忘记密码 验证码身份
            commonAdGetSliderVerify: "commonAdGetSliderVerify", //忘记密码 打开点击验证码
        },
        msg: {
            msg1:"租户不能为空！",
            msg2:"用户名不能为空！",
            msg3:"未获取验证码！",
            msg4: "用户ID！",
            msg5: "手机号码不能为空！",
            getForgotPasswordUserInforMsg3:"验证码不能为空！",
            authenticationMsg2: "无效的上次识别码！",
            authenticationMsg4: "手机号码不正确！",
            authenticationMsg5: "手机号码编码不能为空！",
            fWUpdateNewPassWord2: "上一次验证ID不能为空！",
            fWUpdateNewPassWord3: "密码不能为空！",
            getPhonenVerCodeMsg1: "请输入正确的手机号!",
            getPhonenVerCodeMsg2: "请填写手机号码!"
        },
        stepData: [
            { "title": "填写帐号", "status": "3" },
            { "title": "身份验证" },
            { "title": "设置新密码" },
            { "title": "完成" }
        ]
    },
    home: { //首页
        url: {
            getInfo: "getInfo", // 获取详细信息
            logout: "Logout", // 退出登录
            getNCPDData: "getNCPDData", //获取公示栏
        },
        msg: {
            logoutSucees: "注销成功",
        },
        ConfigurationPath: "config/kav7.config.yml",
        giteeTitle: "KA Stanley 前端源代码",
        giteeUrl: "https://gitee.com/stanleyshen/kav7-layui"
    },
    homeIndex: {
        url: {
            getMenucommon: "getMenucommon", // 获取常用菜单
            getConfig: "getConfig", // 获取配置
            getSysShortcutmenu: "getSysShortcutmenu", //加载快捷入库
            getRouters: "getRouters", //获取用户拥有的权限
            getSysShortcutmenu: "getSysShortcutmenu", //获取快捷菜单
            deleteSysShortcutmenuByUserId: "deleteSysShortcutmenuByUserId", //获取快捷菜单
            addSysShortcutmenuByUserId: "addSysShortcutmenuByUserId", //获取快捷菜单
            SysSystemversionlogGetInfoByCode: "SysSystemversionlogGetInfoByCode", //根据编码查询系统编码
            SysNewstypeList: "SysNewstypeList", //加载新闻类型
            SysNewsabstractList: "SysNewsabstractList", //加载文件摘要
        },
        msg: {
            logoutSucees: "注销成功",
            SysGGTZ: "暂无公告"
        },
        SysVersion: "sys.login.version",//系统版本
        SysGGTZ: "sys.login.versionggtz", //系统公告
    }
}